import Vue from 'vue'
import VueRouetr from 'vue-router'
Vue.use(VueRouetr)
import Home from '@/views/Home'


export const createRouter = () => {
    const router = new VueRouetr({
        // 服务端不接收 hash
        mode: 'history',
        routes: [
            {
                path: '/',
                name: 'home',
                component: Home
            },
            {
                path: '/about',
                name: 'about',
                component: () => import('@/views/About')
            },
            {
                path: '/posts',
                name: 'post-list',
                component: () => import('@/views/Post')
            },
            {
                path: '*',
                name: 'p404',
                component: () => import('@/views/404')
            }
        ]
    })

    return router
}



